<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>

</body>

</html>
<script>
    var userName = '眼镜傻逼'
    var password = '123456'
    for( var i=1; i<=3;i++){
        var userName2 = prompt('请输入用户名:')
        if(userName != userName2){
            console.log('输入用户名有无，你还有' +(3-i)+'次机会');
            continue//跳过当前循环   账号已经错误  不用再继续进行档次循环
        }
        var password2 = prompt('请输入密码')
        if(password != password2){
            console.log('输入密码有误，你还有' +(3-i)+'次机会');
            continue
        }
        alert('恭喜登录成功')
        break
    }
</script>